package com.topvision.myviewtest.recycler;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.topvision.myviewtest.R;
import com.topvision.myviewtest.recycler.itemdecoration.DeviderDecoration;
import com.topvision.myviewtest.recycler.itemdecoration.MyItemDecoration;
import com.topvision.myviewtest.recycler.itemdecoration.PaddingDecoration;

import butterknife.BindView;
import butterknife.ButterKnife;

public class RecyclerViewActivity extends AppCompatActivity {

    @BindView(R.id.recyclerview)
    RecyclerView mRecyclerview;
    private LinearLayoutManager mLinearLayoutManager;
    private MyItemDecoration mItemDecoration;
    private MyAdapter mAdapter;
    private PaddingDecoration mPaddingDecoration;
    private DeviderDecoration mDeviderDecoration;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recycler_view);
        ButterKnife.bind(this);


        mLinearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        mPaddingDecoration = new PaddingDecoration(this);
        mDeviderDecoration = new DeviderDecoration(this);
        mItemDecoration = new MyItemDecoration();
        mAdapter = new MyAdapter();

        mRecyclerview.setLayoutManager(mLinearLayoutManager);
        mRecyclerview.addItemDecoration(mDeviderDecoration);
        mRecyclerview.setAdapter(mAdapter);

    }
}
